package com.chentf.demo3;

import java.util.ArrayList;
import java.util.Random;

/**
 * @author chentengfei
 * @desc 抽奖器类
 * @date 2025-02-06 22:30:52
 */
public class ProductGetter<T> {

    Random random = new Random();

    // 奖品
    private T product;

    // 奖品集合
    ArrayList<T> list = new ArrayList<>();

    // 添加奖品
    public void addProduct(T t) {
        list.add(t);
    }

    // 获取奖品
    public T getProduct() {
        product = list.get(random.nextInt(list.size()));
        return product;
    }
}
